home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / source / timeline / dim.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-15  |  11.8 KB  |  298 lines

  1. /*
  2.  * Copyright (c) 1990, 1991 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, and distribute this software and 
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that (i) the above copyright notices and this permission notice appear in
  7.  * all copies of the software and related documentation, and (ii) the name
  8.  * Stanford may not be used in any advertising or publicity relating to
  9.  * the software without the specific, prior written permission of
  10.  * Stanford.
  11.  * 
  12.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  13.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  14.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  15.  *
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  17.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
  18.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
  19.  * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
  20.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21.  * SOFTWARE.
  22.  */
  23.  
  24. /* $Header: /Source/Media/collab/TimeLine/RCS/dim.c,v 1.11 91/10/05 18:33:25 chua Exp Locker: drapeau $ */
  25. /* $Log:    dim.c,v $
  26.  * Revision 1.11  91/10/05  18:33:25  chua
  27.  * Changed the name Unmute application to Remove mute from application.
  28.  * 
  29.  * Revision 1.0  91/09/30  16:53:31  chua
  30.  * Update to version 1.0
  31.  * 
  32.  * Dim the new entry in the Options menu (Connect with new Port Manager ...)
  33.  * 
  34.  * Revision 0.70  91/09/26  17:59:20  chua
  35.  * Added the menu items Mute application and Unmute application to the list to
  36.  * be dimmed.
  37.  * 
  38.  * Revision 0.69  91/09/25  13:47:01  chua
  39.  * Changed the instrument field, instInfo, to editInfo.
  40.  * 
  41.  * Revision 0.68  91/09/23  17:07:28  chua
  42.  * The stop menu button has been removed.  Dim the new pause and stop buttons
  43.  * when in stop mode.
  44.  * 
  45.  * Revision 0.67  91/09/19  17:28:41  chua
  46.  * Make sure that variables are initialized properly.  Change formatting slightly,
  47.  * so that (if, for, while) statements with only one statement in them will not have
  48.  * braces.
  49.  * 
  50.  * Revision 0.66  91/09/04  15:08:16  chua
  51.  * Changed the rcsid from menurcsid to dimrcsid.
  52.  * 
  53.  * Revision 0.65  91/08/13  15:02:06  chua
  54.  * Do not dim the quit button at any time.
  55.  * 
  56.  * Revision 0.64  91/08/13  14:55:10  chua
  57.  * Added dimming for some new items in the Document and Edit menu (didn't do it 
  58.  * previously).
  59.  * 
  60.  * Revision 0.63  91/08/05  13:01:42  chua
  61.  * Dim the move canvas buttons as well as the panel list and buttons in the region info popup 
  62.  * window.
  63.  * 
  64.  * Revision 0.62  91/08/02  14:28:21  chua
  65.  * Ignore the last RCS message.  The new change is dimming the buttons of the region info
  66.  * panel when playing.
  67.  * 
  68.  * Revision 0.60  91/07/24  10:53:50  chua
  69.  * Dim the notes and pause markers info lists as well during playing.
  70.  * 
  71.  * Revision 0.59  91/07/24  10:32:09  chua
  72.  * Dim the buttons in the Pause popup window as well.
  73.  * 
  74.  * Revision 0.58  91/07/22  15:16:13  chua
  75.  * Changed the name of the pointer to the blank time popup window to InsertBlankTimePopup,
  76.  * instead of a longer name previously.
  77.  * 
  78.  * Revision 0.57  91/06/25  16:31:26  chua
  79.  * Added code to dim the new menu functions.  These are:
  80.  * - Hide Application
  81.  * - Show Application
  82.  * 
  83.  * The above are under the Applications button.
  84.  * 
  85.  * Under the Stop menu button, there are the functions Stop and Pause.
  86.  * These are dimmed when in stop mode and undimmed when in play mode.
  87.  * 
  88.  * The zoom slider is also dimmed during play mode.
  89.  * 
  90.  * Revision 0.56  91/06/04  17:37:11  chua
  91.  * Added the copyright comments in the beginning of the file.
  92.  * 
  93.  * Revision 0.55  91/06/04  17:21:11  chua
  94.  * In the DimButtons routine, add several if-statements to test if certain menu functions
  95.  * are to be undimmed. These functions should not be undimmed if the frame is a Clipboard,
  96.  * as they are permanently disabled for the clipboard, such as the edit functions.
  97.  * 
  98.  * This file used to be menu.c, but changed to dim.c now.
  99.  * 
  100.  * Revision 0.54  91/06/03  11:11:55  chua
  101.  * Make changes to accomodate multiple documents.  This involves identifying
  102.  * which is the current active window, that is, the one where the last mouse
  103.  * click was done.
  104.  * 
  105.  * Revision 0.53  91/05/29  14:37:38  chua
  106.  * *** empty log message ***
  107.  * 
  108.  * Revision 0.52  91/05/29  14:36:01  chua
  109.  * This file contains the DimButtons procedure, which is called when starting or stopping play of
  110.  * the timeline.  It does the dimming and undimming of the buttons depending on what mode the
  111.  * timeline is currently in.
  112.  *  */
  113.  
  114. static char dimrcsid[] = "$Header: /Source/Media/collab/TimeLine/RCS/dim.c,v 1.11 91/10/05 18:33:25 chua Exp Locker: drapeau $";
  115.  
  116. #include "main.h"
  117.  
  118. /*
  119.  * Function to dim or undim all buttons except the stop button when playing is in progress or when stop is pressed.
  120.  * For the stop button, it is dimmed when in Stop mode, and undimmed when playing is in progress.
  121.  * The parameter dim determines if dimming or undimming is to be done.
  122.  * For some of the menu items, if the calling frame is the clipboard, undimming is not done since these menu functions are permanently
  123.  * disabled.  The functions are those within the if-statements.
  124.  * Called by TimeLineInit (TimeLine.c)
  125.  */
  126. void DimButtons(dim, tlFrame)
  127.      int dim;
  128.      TimeLineFramePtr tlFrame;
  129. {
  130.   Menu menu;
  131.   Menu_item mi;
  132.   int whichFrame;
  133.   Instrument *instrument;
  134.   
  135.   whichFrame = xv_get(tlFrame->TimeLine_window->controls, PANEL_CLIENT_DATA);
  136.   menu = xv_get(tlFrame->TimeLine_window->documentButton, PANEL_ITEM_MENU);
  137.   if (whichFrame != 0 || dim) 
  138.   {
  139.     mi = (Menu_item) xv_find (menu, MENUITEM,
  140.                   MENU_STRING, "New ...",
  141.                   NULL);
  142.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  143.     mi = (Menu_item) xv_find (menu, MENUITEM,
  144.                   MENU_STRING, "Open ...",
  145.                   NULL);
  146.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  147.     mi = (Menu_item) xv_find (menu, MENUITEM,
  148.                   MENU_STRING, "Save",
  149.                   NULL);
  150.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  151.     mi = (Menu_item) xv_find (menu, MENUITEM,
  152.                   MENU_STRING, "Save as ...",
  153.                   NULL);
  154.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  155.     mi = (Menu_item) xv_find (menu, MENUITEM,
  156.                   MENU_STRING, "Close",
  157.                   NULL);
  158.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  159.   }
  160.   xv_set(tlFrame->TimeLine_window->documentButton, PANEL_INACTIVE, dim, NULL);
  161.   
  162.   menu = xv_get(tlFrame->TimeLine_window->appButton, PANEL_ITEM_MENU);
  163.   if (whichFrame != 0 || dim) 
  164.   {
  165.     mi = (Menu_item) xv_find (menu, MENUITEM,
  166.                   MENU_STRING, "Update Applications List",
  167.                   NULL);
  168.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  169.     mi = (Menu_item) xv_find (menu, MENUITEM,
  170.                   MENU_STRING, "Delete selected application",
  171.                   NULL);
  172.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  173.   }
  174.   mi = (Menu_item) xv_find (menu, MENUITEM,
  175.                 MENU_STRING, "Show edit info for an application ...",
  176.                 NULL);
  177.   xv_set(mi, MENU_INACTIVE, dim, NULL);
  178.   mi = (Menu_item) xv_find (menu, MENUITEM,
  179.                 MENU_STRING, "Show application",
  180.                 NULL);
  181.   xv_set(mi, MENU_INACTIVE, dim, NULL);
  182.   mi = (Menu_item) xv_find (menu, MENUITEM,
  183.                 MENU_STRING, "Hide application",
  184.                 NULL);
  185.   xv_set(mi, MENU_INACTIVE, dim, NULL);
  186.   mi = (Menu_item) xv_find (menu, MENUITEM,
  187.                 MENU_STRING, "Mute application",
  188.                 NULL);
  189.   xv_set(mi, MENU_INACTIVE, dim, NULL);
  190.   mi = (Menu_item) xv_find (menu, MENUITEM,
  191.                 MENU_STRING, "Remove mute from application",
  192.                 NULL);
  193.   xv_set(mi, MENU_INACTIVE, dim, NULL);
  194.   xv_set(tlFrame->TimeLine_window->appButton, PANEL_INACTIVE, dim, NULL);
  195.  
  196.   menu = xv_get(tlFrame->TimeLine_window->editButton, PANEL_ITEM_MENU);
  197.   if (whichFrame != 0 || dim) 
  198.   {
  199.     mi = (Menu_item) xv_find (menu, MENUITEM,
  200.                   MENU_STRING, "Cut",
  201.                   NULL);
  202.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  203.     mi = (Menu_item) xv_find (menu, MENUITEM,
  204.                   MENU_STRING, "Copy",
  205.                   NULL);
  206.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  207.     mi = (Menu_item) xv_find (menu, MENUITEM,
  208.                   MENU_STRING, "Paste",
  209.                   NULL);
  210.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  211.     mi = (Menu_item) xv_find (menu, MENUITEM,
  212.                   MENU_STRING, "Delete",
  213.                   NULL);
  214.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  215.     mi = (Menu_item) xv_find (menu, MENUITEM,
  216.                   MENU_STRING, "Clear All",
  217.                   NULL);
  218.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  219.     mi = (Menu_item) xv_find (menu, MENUITEM,
  220.                   MENU_STRING, "Show Clipboard ...",
  221.                   NULL);
  222.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  223.     xv_set(tlFrame->TimeLine_window->editButton, PANEL_INACTIVE, dim, NULL);
  224.   }
  225.   menu = xv_get(tlFrame->TimeLine_window->optionsButton, PANEL_ITEM_MENU);
  226.   if (whichFrame != 0 || dim) 
  227.   {
  228.     mi = (Menu_item) xv_find (menu, MENUITEM,
  229.                   MENU_STRING, "Show Region Info ...",
  230.                   NULL);
  231.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  232.     mi = (Menu_item) xv_find (menu, MENUITEM,
  233.                   MENU_STRING, "Insert Blank Time ...",
  234.                   NULL);
  235.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  236.     mi = (Menu_item) xv_find (menu, MENUITEM,
  237.                   MENU_STRING, "Insert/Delete Pause Marker ...",
  238.                   NULL);
  239.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  240.     mi = (Menu_item) xv_find (menu, MENUITEM,
  241.                   MENU_STRING, "Grid",
  242.                   NULL);
  243.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  244.     mi = (Menu_item) xv_find (menu, MENUITEM,
  245.                   MENU_STRING, "Connect with new Port Manager ...",
  246.                   NULL);
  247.     xv_set(mi, MENU_INACTIVE, dim, NULL);
  248.     xv_set(tlFrame->TimeLine_window->optionsButton, PANEL_INACTIVE, dim, NULL);
  249.   }
  250.   menu = xv_get(tlFrame->TimeLine_window->playButton, PANEL_ITEM_MENU);
  251.   mi = (Menu_item) xv_find (menu, MENUITEM,
  252.                 MENU_STRING, "Play whole document",
  253.                 NULL);
  254.   xv_set(mi, MENU_INACTIVE, dim, NULL);
  255.   mi = (Menu_item) xv_find (menu, MENUITEM,
  256.                 MENU_STRING, "Play from insertion point",
  257.                 NULL);
  258.   xv_set(mi, MENU_INACTIVE, dim, NULL);
  259.   mi = (Menu_item) xv_find (menu, MENUITEM,
  260.                 MENU_STRING, "Play selected area",
  261.                 NULL);
  262.   xv_set(mi, MENU_INACTIVE, dim, NULL);
  263.   xv_set(tlFrame->TimeLine_window->playButton, PANEL_INACTIVE, dim, NULL);
  264.   xv_set(tlFrame->TimeLine_window->ZoomSlider, PANEL_INACTIVE, dim, NULL); /* Make the slider inactive */
  265.   xv_set(tlFrame->TimeLine_window->MoveCanvasLeftButton, PANEL_INACTIVE, dim, NULL); /* Make the canvas buttons inactive */
  266.   xv_set(tlFrame->TimeLine_window->MoveCanvasRightButton, PANEL_INACTIVE, dim, NULL); 
  267.   xv_set(tlFrame->TimeLine_window->MoveCanvasFastLeftButton, PANEL_INACTIVE, dim, NULL); 
  268.   xv_set(tlFrame->TimeLine_window->MoveCanvasFastRightButton, PANEL_INACTIVE, dim, NULL); 
  269.   xv_set(tlFrame->TimeLine_window->ResetCanvasButton, PANEL_INACTIVE, dim, NULL); 
  270.   if (whichFrame != 0 || dim) 
  271.   {
  272.     instrument = tlFrame->instHead;                    /* Deactivate all the notes info panel list */
  273.     while (instrument != NULL) 
  274.     {
  275.       xv_set(instrument->editInfo->NoteInfoList, PANEL_INACTIVE, dim, NULL);
  276.       instrument = instrument->next;
  277.     }
  278.     xv_set(tlFrame->InsertBlankTimePopup->InsertBlankTimeButton, PANEL_INACTIVE, dim, NULL);
  279.     xv_set(tlFrame->PausePopup->PauseList, PANEL_INACTIVE, dim, NULL);
  280.     xv_set(tlFrame->PausePopup->InsertPauseButton, PANEL_INACTIVE, dim, NULL);
  281.     xv_set(tlFrame->PausePopup->DeletePauseButton, PANEL_INACTIVE, dim, NULL);
  282.     xv_set(tlFrame->PausePopup->ClearAllPauseButton, PANEL_INACTIVE, dim, NULL);
  283.     
  284.     xv_set(tlFrame->RegionPopup->RegionList, PANEL_INACTIVE, dim, NULL);
  285.     xv_set(tlFrame->RegionPopup->InsertRegionButton, PANEL_INACTIVE, dim, NULL);
  286.     xv_set(tlFrame->RegionPopup->DeleteRegionButton, PANEL_INACTIVE, dim, NULL);
  287.     xv_set(tlFrame->RegionPopup->ModifyRegionButton, PANEL_INACTIVE, dim, NULL);
  288.     xv_set(tlFrame->RegionPopup->ClearAllRegionButton, PANEL_INACTIVE, dim, NULL);
  289.   }
  290.   if (dim == TRUE)                            /* Reverse the dim parameter for the stop and pause buttons */
  291.     dim = FALSE;
  292.   else 
  293.     dim = TRUE;
  294.   xv_set(tlFrame->TimeLine_window->pauseButton, PANEL_INACTIVE, dim, NULL);
  295.   xv_set(tlFrame->TimeLine_window->stopButton, PANEL_INACTIVE, dim, NULL);
  296. }
  297.  
  298.